import React from 'react';
import './App.css';
import Login from './view/login'
import Index from './view/index'
import {
  BrowserRouter as Router,
  Switch,
  Route,
  Redirect,
} from "react-router-dom";
function App() {
  return (
    <Router>
      <Switch>
        <Route path="/login">
          <Login />
        </Route>
        {/* <Route path="/">
        <Index />
        </Route> */}
        <Route path = "/" render = { ()=> {
          return localStorage.getItem('isLogin') === 'true'?
          <Index />:<Redirect to="/login"/>
        }}
        />
      </Switch>  
      </Router>
  );
}

export default App;
